<template>
	<div>
		<Header></Header>
		<!-- 内容 -->
		<div class="w65 ma">
			<!-- 面包屑 -->
			<breadcrumb></breadcrumb>
		</div>
		<div class="detailsTiers" v-show="detailsTier">
			<div class="conent-topw">
				<div class="w65 ma p05 da">
					<div v-for="(item, index) in auditList" :key="index">
						<div
							:class="selIndex == item.id ? 'b2f w6 h1.2 bgc2f6 cfff br05 tac fz08 p04' : 'b03 w6 h1.2 br05 tac c999 fz08 p04 '"
							style="margin-right: 1rem;"
							@click="clickAudit(item.id)"
						>
							{{ item.name }}
						</div>
					</div>
					<div style="width: 100%;text-align: right;"><el-button @click="closeDetail">关闭</el-button></div>
				</div>
				<div class="w65 ma">
					<div v-if="selIndex == 0">
						<el-card class="box-card">
							<table>
								<tr>
									<td class="fwb fz08">钻孔编号</td>
									<td class="fz08">{{ getData.number || noData }}</td>
								</tr>
								<!-- <tr>
									<td class="fwb fz08">钻孔柱状图</td>
									<td class="fz08" v-if="getData.image != null" style="color: #2F6BBB;cursor: pointer;" @click="ddasda">查看</td>
									<td class="fz08" v-else>{{ noData }}</td>
								</tr> -->
								<tr>
									<td class="fwb fz08">原始资料档号</td>
									<td class="fz08">{{ getData.file_number || noData }}</td>
								</tr>
								<tr>
									<td class="fwb fz08">钻孔位置</td>
									<td class="fz08">{{ getData.position || noData }}</td>
								</tr>
								<tr>
									<td class="fwb fz08">钻孔类型</td>
									<td class="fz08">{{ getData.drill_type || noData }}</td>
								</tr>
								<tr>
									<td class="fwb fz08">钻孔深度</td>
									<td class="fz08">{{ getData.altitude || noData }}</td>
								</tr>
								<tr>
									<td class="fwb fz08">钻孔日期</td>
									<td class="fz08">{{ getData.end_time || noData }}</td>
								</tr>
								<tr>
									<td class="fwb fz08">开始时间</td>
									<td class="fz08">{{ getData.start_time || noData }}</td>
								</tr>
								<!-- <tr>
									<td class="fwb fz08">经度</td>
									<td class="fz08">{{ getData.longitude || noData }}</td>
								</tr>
								<tr>
									<td class="fwb fz08">纬度</td>
									<td class="fz08">{{ getData.latitude || noData }}</td>
								</tr> -->
								<tr>
									<td class="fwb fz08">关键字</td>
									<td class="fz08">{{ getData.keyword || noData }}</td>
								</tr>
								<!-- <tr>
									<td class="fwb fz08">钻孔深度</td>
									<td class="fz08">{{ getData.altitude || noData }}</td>
								</tr> -->
								<!-- <tr>
									<td class="fwb fz08">钻孔坐落</td>
									<td class="fz08">{{ getData.district || noData }}</td>
								</tr> -->
								<tr>
									<td class="fwb fz08">比例尺</td>
									<td class="fz08">{{ getData.scale || noData }}</td>
								</tr>
								<tr>
									<td class="fwb fz08">施工单位</td>
									<td class="fz08">{{ getData.construction_unit || noData }}</td>
								</tr>
							</table>
						</el-card>
					</div>
					<div v-if="selIndex == 1">
						<el-card class="box-card">
							<table>
								<tr>
									<td class="fwb fz08">项目名称</td>
									<td class="fz08">{{ getData.entry_name || noData }}</td>
								</tr>
								<tr>
									<td class="fwb fz08">分类</td>
									<td class="fz08">
										<div v-if="getData.type == 1">城市地质</div>
										<div v-if="getData.type == 2">地热资源</div>
										<div v-if="getData.type == 3">区域海洋</div>
									</td>
								</tr>
								<tr>
									<td class="fwb fz08">工作程度</td>
									<td class="fz08">{{ getData.degree_of_work || noData }}</td>
								</tr>
								<tr>
									<td class="fwb fz08">主要矿种</td>
									<td class="fz08">{{ getData.minerals || noData }}</td>
								</tr>
							</table>
						</el-card>
					</div>
					<div v-if="selIndex == 2">
						<el-card class="box-card">
							<table>
								<tr>
									<td class="fwb fz08">保管单位名称</td>
									<!-- <el-popover placement="top-start" title="保管单位信息" width="400" trigger="hover"> -->
									<td class="fz08" style="width: 100rem;position: relative;" @mouseover="mouseOver" @mouseleave="mouseLeave" slot="reference">
										<div>
											{{ getData.construction_unit || noData }}
											<div
												v-if="isShowunit"
												v-html="content.content"
												style="width: 56rem; height: 60rem; overflow-y: auto; box-sizing: border-box; padding: 2rem ; background-color: #FFFFFF;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);border-radius: 30px;position: absolute;top:21px;left:170px;"
											>
												{{ content.content }}
											</div>
										</div>
									</td>
									<!-- </el-popover> -->
								</tr>
								<tr>
									<td class="fwb fz08">保管单位地址</td>
									<td class="fz08">{{ content.address || noData }}</td>
								</tr>
								<tr>
									<td class="fwb fz08">保管单位邮箱</td>
									<td class="fz08">{{ content.email || noData }}</td>
								</tr>
								<tr>
									<td class="fwb fz08">保管单位电话</td>
									<td class="fz08">{{ content.phone || noData }}</td>
								</tr>
								<tr>
									<td class="fwb fz08">保管单位传真</td>
									<td class="fz08">{{ content.chuanzhen || noData }}</td>
								</tr>
								<tr>
									<td class="fwb fz08">保管单位网址</td>
									<td class="fz08">{{ content.wangzhi || noData }}</td>
								</tr>
								<tr>
									<td class="fwb fz08">保管单位邮编</td>
									<td class="fz08">{{ content.youbian || noData }}</td>
								</tr>
							</table>
						</el-card>
					</div>
				</div>
			</div>
		</div>
		<div class="conent-top">
			<div class="w65 ma p05">
				<el-row :gutter="20">
					<el-col :span="2"><el-button size="small" icon="el-icon-thumb" @click="advancedSeach">高级搜索</el-button></el-col>
					<el-col :span="2">
						<el-button
							size="small"
							style="background-color: #94cff8;color: #ffffff;border: 1px solid #8dbce0;"
							:icon="showTables ? 'el-icon-circle-close' : 'el-icon-circle-check'"
							@click="showTableClick"
						>
							{{ showTable }}
						</el-button>
					</el-col>
					<el-col :span="18">
						<el-input v-model="queryParams.content" clearable size="small" suffix-icon="el-icon-search" style="width: 18rem" placeholder="请输入关键字"></el-input>
						<el-button size="small" class="seach-btn" @click="commonSeach">搜索</el-button>
						<!-- <el-button size="small" class="result-btn">在结果中搜索</el-button> -->
					</el-col>
					<el-col :span="2"><el-button class="add-btn" type="primary" plain size="small" icon="el-icon-plus" @click="addDrill" v-if="showRules">新增</el-button></el-col>
				</el-row>
				<!-- 钻孔管理div -->
				<div id="cesiumContainer" style="width: 99%;height: 40rem;padding-top: 0.5rem;position: relative;"></div>
				<div v-if="showTables" style="width: 65%; position: absolute; top: 40rem;">
					<el-table
						:data="tableData"
						border
						v-loading="loading"
						style="width: 99%;height:32.5rem"
						:header-cell-style="{
							background: '#F5F5F5',
							color: '#000000',
							border: '#F5F5F5'
						}"
						:cell-style="{ border: '#ffffff' }"
					>
						<el-table-column width="80" align="center" label="智能地图">
							<template slot-scope="scope">
								<div class="star">
									<div
										:class="scope.row.collection == 1 ? 'iconfont icon-star' : 'iconfont icon-star star-active'"
										@click="selStar(scope.row.id, scope.row.collection)"
									></div>
								</div>
							</template>
						</el-table-column>
						<el-table-column prop="number" label="钻孔编号" align="center" show-overflow-tooltip>
							<template slot-scope="scope">
								<div style="color: #146ac1">{{ scope.row.number }}</div>
							</template>
						</el-table-column>
						<el-table-column prop="drill_type" label="分类" show-overflow-tooltip align="center">
							<template slot-scope="scope">
								<div v-if="scope.row.type == 1">城市地质</div>
								<div v-if="scope.row.type == 2">地热资源</div>
								<div v-if="scope.row.type == 3">区域海洋</div>
							</template>
						</el-table-column>
						<el-table-column prop="altitude" label="钻孔深度" align="center"></el-table-column>
						<el-table-column prop="end_time" label="钻孔日期" align="center"></el-table-column>
						<!-- <el-table-column prop="district" label="钻孔坐落" show-overflow-tooltip width="200" align="center"></el-table-column> -->
						<el-table-column prop="entry_name" label="项目名称" show-overflow-tooltip align="center"></el-table-column>
						<el-table-column prop="construction_unit" label="保管单位名称" show-overflow-tooltip align="center"></el-table-column>
						<el-table-column fixed="right" align="center" width="200" label="操作">
							<template slot-scope="scope">
								<div style="display: flex;justify-content: center;align-items: center;">
									<div class="c2f cp" @click="examineClick(scope.row)">
										<i class="el-icon-view"></i>
										查看
									</div>
									<div class="cff0 cp" style="padding-left: 0.4rem" @click="delClick(scope.row)" v-if="showRule">
										<i class="el-icon-delete"></i>
										删除
									</div>
									<div class="c999 cp" style="padding-left: 0.4rem" @click="location(scope.row)">
										<i class="el-icon-s-promotion"></i>
										定位
									</div>
								</div>
							</template>
						</el-table-column>
					</el-table>
					<div class="tar p1">
						<el-pagination
							@size-change="handleSizeChange"
							@current-change="handleCurrentChange"
							:page-sizes="[10, 20, 30, 40]"
							:page-size="queryParams.page"
							background
							layout="total, sizes, prev, pager, next, jumper"
							:total="count"
						></el-pagination>
					</div>
				</div>
			</div>
		</div>
		<!-- 高级搜索 -->
		<el-dialog title="高级搜索" :visible.sync="advancedSeachDialog" width="46%" :before-close="advancedHandleClose" v-dialogDrag>
			<el-form ref="form" :model="form" label-width="120px">
				<el-row>
					<el-col :span="12">
						<el-form-item label="钻孔编号" prop="number">
							<autocomplete :allInfos="allInfos" :placeholder="placeholderNumber" @dimDepartment="drillAll"></autocomplete>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="项目名称" prop="entry_name">
							<autocomplete :allInfos="entryName" :placeholder="placeholderEntry_name" @dimDepartment="projectName"></autocomplete>
						</el-form-item>
					</el-col>
					<!-- 	<el-col :span="12">
						<el-form-item label="保管单位" prop="name">
							<autocomplete :allInfos="name" :placeholder="placeholderName" @dimDepartment="projectWorkName"></autocomplete>
						</el-form-item>
					</el-col> -->
					<el-col :span="12">
						<el-form-item label="保管单位" prop="construction_unit">
							<autocomplete
								:allInfos="construction_unitname"
								:placeholder="placeholderConstruction_unit"
								@dimDepartment="projectConstruction_unitName"
							></autocomplete>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="钻孔类型" prop="drill_type">
							<autocomplete :allInfos="drill_typeName" :placeholder="placeholderDrill_type" @dimDepartment="projectdrill_typeName"></autocomplete>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="主要矿种" prop="minerals">
							<!-- <el-input style="width: 15rem" placeholder="请输入主要矿种" size="small" v-model="form.minerals"></el-input> -->
							<autocomplete :allInfos="mineralsName" :placeholder="placeholderMinerals" @dimDepartment="projectmineralsName"></autocomplete>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="比例尺" prop="scale">
							<!-- <el-input style="width: 15rem" placeholder="请输入比例尺" size="small" v-model="form.scale"></el-input> -->
							<autocomplete :allInfos="scaleName" :placeholder="placeholderScale" @dimDepartment="projectscaleName"></autocomplete>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="工作程度" prop="degree_of_work">
							<!-- <el-input style="width: 15rem" placeholder="请输入工作程度" size="small" v-model="form.degree_of_work"></el-input> -->
							<autocomplete :allInfos="degree_of_workName" :placeholder="placeholderDegree_of_work" @dimDepartment="projectdegree_of_workName"></autocomplete>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="钻孔深度" prop="altitude_max">
							<el-input style="width: 18rem" placeholder="请输入钻孔深度" v-model="form.altitude_max">
								<template slot="prepend">
									不小于
								</template>
							</el-input>
						</el-form-item>
					</el-col>
					<!-- <el-col :span="12">
						<el-form-item label="钻孔日期" prop="name">
							<el-date-picker size="small" style="width: 18rem;" v-model="form.value" type="date" placeholder="选择项目结束时间"></el-date-picker>
						</el-form-item>
					</el-col> -->
					<el-col :span="12">
						<el-form-item label="项目结束时间" prop="name">
							<el-date-picker
								style="width: 18rem"
								value-format="yyyy-MM-dd"
								v-model="daterange"
								@change="selDaterange"
								type="daterange"
								range-separator="至"
								start-placeholder="开始日期"
								end-placeholder="结束日期"
							></el-date-picker>
						</el-form-item>
					</el-col>
					<!-- <el-col :span="12">
						<el-form-item label="业主单位" prop="owner_unit">
							<autocomplete :allInfos="owner_unitName" :placeholder="placeholderoOwner_unit" @dimDepartment="projectowner_unitName"></autocomplete>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="业主电话" prop="owner_phone">
							<autocomplete :allInfos="owner_phoneName" :placeholder="placeholderOwner_phone" @dimDepartment="projectowner_phoneName"></autocomplete>
						</el-form-item>
					</el-col> -->
					<!-- <el-col :span="12">
						<el-form-item label="钻孔坐落" prop="district">
							<autocomplete :allInfos="owner_district" :placeholder="placeholderOwner_district" @dimDepartment="projectowner_district"></autocomplete>
						</el-form-item>
					</el-col> -->
				</el-row>
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button class="seach" @click="onSubmit">搜 索</el-button>
				<el-button class="resultSeach" @click="advancedSeachDialog = false">关闭</el-button>
			</span>
		</el-dialog>
		<!-- 查看大图 -->
		<dialogImg :lookImg="lookImg" :biggerImg="biggerImg" @handleClose="handleClose" v-if="biggerImg"></dialogImg>
	</div>
</template>

<script>
import { zkSel } from '@/api/resourceCenter.js';
import breadcrumb from '@/components/breadcrumb .vue';
import dialogImg from '@/components/dialogImg.vue';
import noData from '@/assets/noData.jpg';
import autocomplete from '@/components/autocomplete.vue';
import { drillList, delDrill, vagueSearch, drillDetails, safekeepingUnit } from '@/api/drill.js';
import { getItem, setItem, removeItem } from '@/utils/storage.js';
import { userRule } from '@/api/user.js';
import './../../scss/icon-star.css';
import { Viewer, ArcGisMapServerImageryProvider, GeoJsonDataSource, TileMapServiceImageryProvider, buildModuleUrl, Cartesian3, HeightReference, Cartesian2 } from 'cesium';
export default {
	name: 'drillAdmin',
	components: {
		breadcrumb,
		dialogImg,
		autocomplete
	},
	data() {
		return {
			isShowunit: false,
			biggerImg: false,
			getData: {},
			lookImg: '',
			selIndex: 0,
			auditList: [{ name: '钻孔信息', id: 0 }, { name: '项目信息', id: 1 }, { name: '保管单位信息', id: 2 }],
			content: null,
			detailsTier: false,
			input: '',
			isLogin: getItem('token'),
			//高级搜索表单
			daterange: [],
			loading: false,
			form: {
				pageSize: 10,
				page: 1,
				end_time_min: null,
				end_time_max: null,
				number: null,
				token: getItem('token')
			},
			//搜索弹窗
			advancedSeachDialog: false,
			tableData: [],
			queryParams: {
				pageSize: 10,
				page: 1,
				content: null,
				token: getItem('token')
			},
			count: null,
			showRule: false,
			showRules: false,
			//显示table按钮
			showTable: '隐藏',
			showTables: true,
			allInfos: [],
			entryName: [],
			name: [],
			construction_unitname: [],
			drill_typeName: [],
			mineralsName: [],
			scaleName: [],
			degree_of_workName: [],
			owner_unitName: [],
			owner_phoneName: [],
			owner_district: [],
			viewer: undefined,
			placeholderoOwner_unit: '请选择业主单位',
			placeholderOwner_phone: '请选择业主电话',
			placeholderDegree_of_work: '请选择工作程度',
			placeholderScale: '请选择比例尺',
			placeholderMinerals: '请选择主要矿种',
			placeholderDrill_type: '请选择钻孔类型',
			placeholderConstruction_unit: '请选择保管单位',
			placeholderName: '请选择工作区名称',
			placeholderEntry_name: '请选择项目名称',
			placeholderNumber: '请选择钻孔编号',
			// placeholderOwner_district: '请选择钻孔坐落'
		};
	},
	beforeRouteLeave(to, from, next) {
		if (to.name != 'drillAdmin') {
			document.body.style.overflow = 'visible';
			// removeItem('cesium');
		}
		next();
	},
	created() {
		this.getDrillList();
		//1删除钻孔
		this.getUserRule(5);
		//添加钻孔
		this.getUserRule(6);
	},
	mounted() {
		this.viewer = new Viewer('cesiumContainer', {
			selectionIndicator: true,
			infoBox: false,
			homeButton: false,
			timeline: false,
			navigationHelpButton: false,
			sceneModePicker: false,
			fullscreenButton: false,
			animation: false,
			baseLayerPicker: false,
			geocoder: false,
			imageryProvider: new TileMapServiceImageryProvider({
				url: buildModuleUrl('Assets/Textures/NaturalEarthII')
			})
		});
		let viewer = this.viewer;
		viewer._cesiumWidget._creditContainer.style.display = 'none';
		GeoJsonDataSource.load('http://117.73.254.217:2221/resources/others/山东市级区划.geojson').then(dataSource => {
			viewer.dataSources.add(dataSource);
			viewer.flyTo(dataSource);
		});
		viewer.scene.imageryLayers.addImageryProvider(
			new ArcGisMapServerImageryProvider({
				url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
			})
		);
		viewer.scene.imageryLayers.addImageryProvider(
			new Cesium.WebMapTileServiceImageryProvider({   //调用影响中文注记服务
				url: "http://t0.tianditu.com/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg&tk=733bbd8eeb44d5c315ebf51a2778992a",
				layer: "tdtAnnoLayer",
				style: "default",
				format: "image/jpeg",
				tileMatrixSetID: "GoogleMapsCompatible",
				show: false
			})
		);
	},
	methods: {
		ToDigital(strDu, strFen, strMiao, len) {
			len = len > 6 || typeof len == 'undefined' ? 6 : len; //精确到小数点后最多六位
			strDu = typeof strDu == 'undefined' || strDu == '' ? 0 : parseFloat(strDu);
			strFen = typeof strFen == 'undefined' || strFen == '' ? 0 : parseFloat(strFen) / 60;
			strMiao = typeof strMiao == 'undefined' || strMiao == '' ? 0 : parseFloat(strMiao) / 3600;
			var digital = strDu + strFen + strMiao;
			if (digital == 0) {
				return '';
			} else {
				return digital.toFixed(len);
			}
		},
		getUserRule(val) {
			//按钮权限
			userRule(val).then(res => {
				if (res.code == 1001) {
					if (val == 5) {
						this.showRule = true;
					}
					if (val == 6) {
						this.showRules = true;
					}
				}
			});
		},
		showTableClick() {
			this.showTables = !this.showTables;
			if (this.showTables) {
				this.showTable = '隐藏';
			} else {
				this.showTable = '显示';
			}
		},
		getDrillList() {
			this.loading = true;
			drillList(this.queryParams).then(res => {
				console.log(res);
				this.loading = false;
				this.tableData = res.data.arr; //__________________________________________
				this.viewer.entities.removeAll();
				for (let i = 0; i < res.data.arr.length; i++) {
					let du_lng = parseFloat(res.data.arr[i].longitude.split('°')[0]);
					let fen_lng = parseFloat(res.data.arr[i].longitude.split('°')[1].split('′')[0]);
					let miao_lng = parseFloat(
						res.data.arr[i].longitude
							.split('°')[1]
							.split('′')[1]
							.replace('"', '')
					);
					let du_lat = parseFloat(res.data.arr[i].latitude.split('°')[0]);
					let fen_lat = parseFloat(res.data.arr[i].latitude.split('°')[1].split('′')[0]);
					let miao_lat = parseFloat(
						res.data.arr[i].latitude
							.split('°')[1]
							.split('′')[1]
							.replace('"', '')
					);

					let lng = this.ToDigital(du_lng, fen_lng, miao_lng, 6);
					let lat = this.ToDigital(du_lat, fen_lat, miao_lat, 6);
					let name = res.data.arr[i].number;
					let entry_name = res.data.arr[i].entry_name;
					this.viewer.entities.add({
						id: name,
						// eslint-disable-next-line no-undef
						position: Cesium.Cartesian3.fromDegrees(parseFloat(lng), parseFloat(lat)),
						label: {
							text: entry_name,
							font: '9px Helvetica',
							showBackground: true,
							// eslint-disable-next-line no-undef
							pixelOffset: new Cesium.Cartesian2(0, 25)
							// heightReference: HeightReference.CLAMP_TO_GROUND
						},
						billboard: {
							image: require('../../assets/ziyuandetail/maplan.png'),
							// heightReference: HeightReference.CLAMP_TO_GROUND,
							// eslint-disable-next-line no-undef
							pixelOffset: new Cesium.Cartesian2(0, -0)
						}
					});
				}
				if (getItem('cesium')) {
					this.viewer.selectedEntity = this.viewer.entities.getById(getItem('cesium'));
				}
				this.count = res.data.count;
				// 钻孔变化
			});
		},
		browse(val) {
			if (val == null) {
				this.lookImg = noData;
			} else {
				this.lookImg = this.url + val;
			}
			// this.lookImg = val.image;
			this.biggerImg = true;
		},
		handleClose(val) {
			this.biggerImg = val;
		},
		//普通搜索
		commonSeach() {
			this.getDrillList();
		},
		//选择日期区间
		selDaterange(val) {
			this.form.end_time_min = val[0];
			this.form.end_time_max = val[1];
		},
		mouseOver() {
			this.isShowunit = true;
		},
		mouseLeave() {
			this.isShowunit = false;
		},
		//编辑
		examineClick(row) {
			let data = {
				id: row.id
			};
			drillDetails(data).then(res => {
				console.log(res.data);
				this.getData = res.data;
				this.detailsTier = true;
				document.body.scrollTop = 0;
				document.documentElement.scrollTop = 0;
				document.body.style.overflow = 'hidden';
				safekeepingUnit({ safekeeping_unit: res.data.construction_unit.trim() }).then(res => {
					// let arrUtil = [];
					this.content = res.data;
				});
				if (res.data.image == null) {
					this.lookImg = noData;
				} else {
					this.lookImg = this.url + res.data.image;
				}
			});
			// this.$router.push({
			// 	path: '/drillDetails',
			// 	query: {
			// 		id: row.id
			// 	}
			// });
		},
		closeDetail() {
			this.detailsTier = false;
			document.body.scrollTop = 0;
			document.documentElement.scrollTop = 0;
			document.body.style.overflow = 'visible';
		},
		//新增钻孔
		addDrill() {
			this.$router.push({
				path: '/addDrill'
			});
		},
		//高级搜索
		advancedSeach() {
			vagueSearch({ name: 'entry_name' }).then(res => {
				this.entryName = res.data;
			});
			vagueSearch({ name: 'number' }).then(res => {
				if (res.code == 1001) {
					this.allInfos = res.data;
				}
			});
			vagueSearch({ name: 'name' }).then(res => {
				if (res.code == 1001) {
					this.name = res.data;
				}
			});
			vagueSearch({ name: 'construction_unit' }).then(res => {
				if (res.code == 1001) {
					this.construction_unitname = res.data;
				}
			});
			vagueSearch({ name: 'drill_type' }).then(res => {
				if (res.code == 1001) {
					this.drill_typeName = res.data;
				}
			});
			vagueSearch({ name: 'minerals' }).then(res => {
				if (res.code == 1001) {
					this.mineralsName = res.data;
				}
			});
			vagueSearch({ name: 'scale' }).then(res => {
				if (res.code == 1001) {
					this.scaleName = res.data;
				}
			});
			vagueSearch({ name: 'degree_of_work' }).then(res => {
				if (res.code == 1001) {
					this.degree_of_workName = res.data;
				}
			});
			vagueSearch({ name: 'owner_unit' }).then(res => {
				if (res.code == 1001) {
					this.owner_unitName = res.data;
				}
			});
			vagueSearch({ name: 'owner_phone' }).then(res => {
				if (res.code == 1001) {
					this.owner_phoneName = res.data;
				}
			});
			vagueSearch({ name: 'district' }).then(res => {
				if (res.code == 1001) {
					this.owner_district = res.data;
				}
			});
			this.advancedSeachDialog = true;
		},
		drillAll(val) {
			this.form.number = val;
		},
		projectName(value) {
			this.form.entry_name = value;
		},
		//工作区名称
		projectWorkName(value) {
			this.form.name = value;
		},
		//施工单位
		projectConstruction_unitName(value) {
			this.form.construction_unit = value;
		},
		//钻孔类型
		projectdrill_typeName(value) {
			this.form.drill_type = value;
		},
		//主要矿种
		projectmineralsName(value) {
			this.form.minerals = value;
		},
		//比例尺
		projectscaleName(value) {
			this.form.scale = value;
		},
		//工作程度
		projectdegree_of_workName(value) {
			this.form.degree_of_work = value;
		},
		//业主单位
		projectowner_unitName(value) {
			this.form.projectowner_unit = value;
		},
		//业主电话
		projectowner_phoneName(value) {
			this.from.owner_phone = value;
		},
		//坐落
		projectowner_district(value) {
			this.from.district = value;
		},
		//获取全部结果
		//关闭弹窗
		advancedHandleClose() {
			this.advancedSeachDialog = false;
			this.form = {
				pageSize: 10,
				page: 1,
				end_time_min: null,
				end_time_max: null
			};
			this.daterange = [];
		},
		//高级搜索提交
		onSubmit() {
			drillList(this.form).then(res => {
				this.tableData = res.data.arr;
				this.count = res.data.count;
				this.advancedHandleClose();
				this.viewer.entities.removeAll();
				for (let i = 0; i < res.data.arr.length; i++) {
					let du_lng = parseFloat(res.data.arr[i].longitude.split('°')[0]);
					let fen_lng = parseFloat(res.data.arr[i].longitude.split('°')[1].split('′')[0]);
					let miao_lng = parseFloat(
						res.data.arr[i].longitude
							.split('°')[1]
							.split('′')[1]
							.replace('"', '')
					);
					let du_lat = parseFloat(res.data.arr[i].latitude.split('°')[0]);
					let fen_lat = parseFloat(res.data.arr[i].latitude.split('°')[1].split('′')[0]);
					let miao_lat = parseFloat(
						res.data.arr[i].latitude
							.split('°')[1]
							.split('′')[1]
							.replace('"', '')
					);

					let lng = this.ToDigital(du_lng, fen_lng, miao_lng, 6);
					let lat = this.ToDigital(du_lat, fen_lat, miao_lat, 6);
					let name = res.data.arr[i].number;
					this.viewer.entities.add({
						id: name,
						position: Cartesian3.fromDegrees(parseFloat(lng), parseFloat(lat)),
						label: {
							text: name,
							font: '9px Helvetica',
							showBackground: true,
							pixelOffset: new Cartesian2(0, 25)
							// heightReference: HeightReference.CLAMP_TO_GROUND
						},
						billboard: {
							image: require('../../assets/ziyuandetail/maplan.png'),
							// heightReference: HeightReference.CLAMP_TO_GROUND,
							pixelOffset: new Cartesian2(0, -0)
						}
					});
				}
				// 钻孔高级搜索
			});
		},
		//删除
		delClick(row) {
			this.$confirm('确认要删除选中项吗?', '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			})
				.then(() => {
					let data = {
						token: getItem('token'),
						id: row.id
					};
					delDrill(data).then(res => {
						if (res.code == 1001) {
							this.msgSuccess(res.msg);
							this.getDrillList();
						}
					});
				})
				.catch(() => {});
		},
		//选择是否在地图
		selStar(id, collection) {
			let sel = {
				id,
				collection: this.isStatus(collection),
				token: getItem('token')
			};
			zkSel(sel).then(() => {
				this.getDrillList();
			});
		},
		isStatus(val) {
			if (val == 0) {
				return 1;
			} else {
				return 0;
			}
		},
		//定位获取数据
		location(val) {
			setItem('cesium', val.number);
			this.viewer.selectedEntity = this.viewer.entities.getById(val.number);
		},
		handleSizeChange(val) {
			this.queryParams.pageSize = val;
			this.getDrillList();
		},
		handleCurrentChange(val) {
			this.queryParams.page = val;
			this.getDrillList();
		},
		clickAudit(val) {
			this.selIndex = val;
		},
		ddasda() {
			this.biggerImg = true;
		},
		handleClose(val) {
			this.biggerImg = val;
		}
	}
};
</script>
<style scoped lang="scss">
.conent-top {
	// background-color: #ffffff;
	// height: 100%;
	// z-index: 1000;
}
.seach-btn {
	background-color: #146ac1;
	color: #ffffff;
	padding: 0.6rem 2rem;
	margin-left: 1rem;
}
.result-btn {
	background-color: #d3d3d3;
}
.add-btn {
	background-color: #ffffff;
}
/deep/.el-pagination.is-background .el-pager li:not(.disabled).active {
	background-color: #2f6bbb;
}
/deep/.el-dialog__header {
	background-color: #2f6bbb;
	.el-dialog__title {
		color: #ffffff;
	}
	.el-icon-close {
		color: #ffffff;
	}
}
.seach {
	background-color: #146ac1;
	color: #ffffff;
}
.resultSeach {
	background-color: #d3d3d3;
	color: #000000;
}
.icon-star {
	color: #fee240;
	font-size: 30px;
}
.icon-star.star-active {
	color: #dddddd;
	font-size: 30px;
}
.el-table {
	z-index: 100;
}
.detailsTiers {
	// width: 100%;
	// height: 100%;
	background-color: #ffffff;
	position: fixed;
	top: 21%;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 200;
}
.conent-topw {
	background-color: #ffffff;
	height: 65rem;
	margin-top: 1rem;
}
table {
	width: 100%;
	border-top: 1px solid #ccc;
	border-left: 1px solid #ccc;
	margin: 0;
	border-collapse: collapse;
	border-spacing: 0;
}
/*控制cellspacing*/
table td {
	padding: 0.7rem;
	width: 10rem;
	font-size: 0.9rem;
	border-right: 1px solid #ccc;
	border-bottom: 1px solid #ccc;
}
.box-card {
	height: 60rem;
}
::-webkit-scrollbar {
	display: none; /* Chrome Safari */
}
</style>
